/*
 * Copyright (c) 2006, 2023, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

/**
 * <p>Project: jse2302 - Str2
 * <p>Powered by webrx On 2023-06-19 14:41:10
 * <p>Created by IntelliJ IDEA
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Str2 {
    public static void main(String[] args) {
        String s1 = "Java";
        String s2 = "java";
        System.out.println(s1 == s2); //false
        System.out.println(s1.equals(s2));
        System.out.println(s1.equalsIgnoreCase(s2));


        //

        String s3 = new String("java");
        String s4 = new String("java");
        System.out.println(s3 == s4);

        //判断字符串内容是否相等
        System.out.println(s3.equals(s4));
        System.out.println(s3.equalsIgnoreCase(s4));

        //判断有没有子串
        System.out.println("hellojava".contains("php"));
        System.out.println("hellojava".contains("java"));

        //返回字符个数
        System.out.println("java中文".length());
        //字节数
        System.out.println("java中文".getBytes().length);

        //trim
        System.out.println("     java  ok    ".trim());
        System.out.println("     java  ok    ".stripLeading());
        System.out.println("     java  ok    ".stripTrailing());//清右空格
        System.out.println("     java  ok    ".replace(" ",""));
        System.out.println("*".repeat(16));
        System.out.println("*".repeat(15));
    }
}
